home *** CD-ROM | disk | FTP | other *** search
/ Motor Sport Digital Archive Collection 1960s / Motor Sport Digital Archive Collection 1960s.iso / main.swf / scripts / mx / collections / XMLListCollection.as < prev   
Encoding:
Text File  |  2008-05-21  |  4.1 KB  |  164 lines

  1. package mx.collections
  2. {
  3.    import mx.core.mx_internal;
  4.    
  5.    use namespace mx_internal;
  6.    
  7.    public class XMLListCollection extends ListCollectionView
  8.    {
  9.       mx_internal static const VERSION:String = "2.0.1.0";
  10.       
  11.       public function XMLListCollection(param1:XMLList = null)
  12.       {
  13.          super();
  14.          this.source = param1;
  15.       }
  16.       
  17.       private function execXMLListFunction(param1:Function) : XMLList
  18.       {
  19.          var _loc2_:int = 0;
  20.          var _loc3_:XMLList = null;
  21.          var _loc4_:int = 0;
  22.          var _loc5_:Object = null;
  23.          if(!localIndex)
  24.          {
  25.             return param1(source);
  26.          }
  27.          _loc2_ = int(localIndex.length);
  28.          _loc3_ = new XMLList("");
  29.          _loc4_ = 0;
  30.          while(_loc4_ < _loc2_)
  31.          {
  32.             _loc5_ = localIndex[_loc4_];
  33.             _loc3_ += param1(_loc5_);
  34.             _loc4_++;
  35.          }
  36.          return _loc3_;
  37.       }
  38.       
  39.       override public function toString() : String
  40.       {
  41.          var _loc1_:* = null;
  42.          var _loc2_:int = 0;
  43.          if(!localIndex)
  44.          {
  45.             return source.toString();
  46.          }
  47.          _loc1_ = "";
  48.          _loc2_ = 0;
  49.          while(_loc2_ < localIndex.length)
  50.          {
  51.             if(_loc2_ > 0)
  52.             {
  53.                _loc1_ += "\n";
  54.             }
  55.             _loc1_ += localIndex[_loc2_].toString();
  56.             _loc2_++;
  57.          }
  58.          return _loc1_;
  59.       }
  60.       
  61.       public function attributes() : XMLList
  62.       {
  63.          return execXMLListFunction(function(param1:Object):XMLList
  64.          {
  65.             return param1.attributes();
  66.          });
  67.       }
  68.       
  69.       [Bindable("listChanged")]
  70.       public function get source() : XMLList
  71.       {
  72.          return !!list ? XMLListAdapter(list).source : null;
  73.       }
  74.       
  75.       public function descendants(param1:Object = "*") : XMLList
  76.       {
  77.          var name:Object = param1;
  78.          return execXMLListFunction(function(param1:Object):XMLList
  79.          {
  80.             return param1.descendants(name);
  81.          });
  82.       }
  83.       
  84.       public function attribute(param1:Object) : XMLList
  85.       {
  86.          var attributeName:Object = param1;
  87.          return execXMLListFunction(function(param1:Object):XMLList
  88.          {
  89.             return param1.attribute(attributeName);
  90.          });
  91.       }
  92.       
  93.       public function child(param1:Object) : XMLList
  94.       {
  95.          var propertyName:Object = param1;
  96.          return execXMLListFunction(function(param1:Object):XMLList
  97.          {
  98.             return param1.child(propertyName);
  99.          });
  100.       }
  101.       
  102.       public function set source(param1:XMLList) : void
  103.       {
  104.          list = new XMLListAdapter(param1);
  105.       }
  106.       
  107.       public function text() : XMLList
  108.       {
  109.          return execXMLListFunction(function(param1:Object):XMLList
  110.          {
  111.             return param1.text();
  112.          });
  113.       }
  114.       
  115.       public function toXMLString() : String
  116.       {
  117.          var _loc1_:* = null;
  118.          var _loc2_:int = 0;
  119.          if(!localIndex)
  120.          {
  121.             return source.toXMLString();
  122.          }
  123.          _loc1_ = "";
  124.          _loc2_ = 0;
  125.          while(_loc2_ < localIndex.length)
  126.          {
  127.             if(_loc2_ > 0)
  128.             {
  129.                _loc1_ += "\n";
  130.             }
  131.             _loc1_ += localIndex[_loc2_].toXMLString();
  132.             _loc2_++;
  133.          }
  134.          return _loc1_;
  135.       }
  136.       
  137.       public function copy() : XMLList
  138.       {
  139.          return execXMLListFunction(function(param1:Object):XMLList
  140.          {
  141.             return XMLList(param1.copy());
  142.          });
  143.       }
  144.       
  145.       public function elements(param1:String = "*") : XMLList
  146.       {
  147.          var name:String = param1;
  148.          return execXMLListFunction(function(param1:Object):XMLList
  149.          {
  150.             return param1.elements(name);
  151.          });
  152.       }
  153.       
  154.       public function children() : XMLList
  155.       {
  156.          return execXMLListFunction(function(param1:Object):XMLList
  157.          {
  158.             return param1.children();
  159.          });
  160.       }
  161.    }
  162. }
  163.  
  164.